package com.mojo.cglib;

import org.springframework.cglib.proxy.Enhancer;

/**
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2021, 广州九尾信息科技有限公司
 * @date 2021/9/6 18:26
 */
public class Client {
    public static void main(String[] args) {
        //cglib动态代理
        //创建增强类
        Enhancer enhancer = new Enhancer();
        //设置属性
        enhancer.setSuperclass(HelloService.class);
        enhancer.setCallback(new MyMethodInterceptor());
        //获取代理类增强子类
        HelloService helloService = (HelloService) enhancer.create();
        helloService.hello();
    }
}
